import { createStore, applyMiddleware } from 'redux'
import reducer from './reducer' //引入reducer函数
// redux调试工具使用的包
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'

const store = createStore(
  reducer,
  // { xxx: 111, yyy: 222 }, 第二个参数是可选参数,可以用来初始化数据,但是不用
  composeWithDevTools(applyMiddleware(thunk))
)
store.subscribe(() => {
  console.log('store的数据改变了', store.getState())
})
export default store
